home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Snippets / PNL Libraries / Libraries / RegExp / regexp.p < prev   
Text File  |  1996-08-12  |  1KB  |  45 lines

  1. unit RegExp;
  2.  
  3. interface
  4.  
  5.     uses
  6.         Types;
  7.         
  8.     const 
  9.         NSUBEXP  = 10;
  10.  
  11.     type
  12.         regexp = record
  13.             startp: array[0..NSUBEXP-1] of Ptr;
  14.             endp: array[0..NSUBEXP-1] of Ptr;
  15.             regstart: longint;            { Internal use only. }
  16.             reganch: longint;        { Internal use only. }
  17.             regmust: Ptr;            { Internal use only. }
  18.             regmlen: longint;        { Internal use only. }
  19.             data: longint;            { Unwarranted chumminess with compiler. }
  20.         end;
  21.         regexpPtr = ^regexp;
  22.         RegErrorProc = procedure (msg: CStringPtr);
  23.     
  24.     var
  25.         regerror_proc: RegErrorProc;
  26.         
  27.     function regcomp( expression: CStringPtr; excompat: longint ): regexpPtr;
  28.     procedure regfree( prog: regexpPtr );
  29.     function regexec( prog: regexpPtr; data: CStringPtr ): longint;
  30.     function regsub( prog: regexpPtr; source: CStringPtr; dest: CStringPtr; n: longint ): CStringPtr;
  31.     
  32.     procedure regerror( msg: CStringPtr ); { you must define this }
  33.  
  34. implementation
  35.  
  36.     procedure regerror( msg: CStringPtr );
  37.     begin
  38.         if regerror_proc <> nil then begin
  39.             regerror_proc( msg );
  40.         end;
  41.     end;
  42.     
  43. end.
  44.  
  45.